<script setup>
import { computed, ref } from 'vue'

// 使用计算属性
const arr = ref([1, 2, 3, 4, 5, 6, 7, 8, 9])
const filterArr = computed(()=>{
  return arr.value.filter(item => item % 2 === 0)
})

setTimeout(()=>{
  arr.value.push(11, 12, 13, 14, 15)
}, 3000)

</script>

<template>
  <div>原数组: {{ arr }}</div>
  <div>筛选后数组: {{ filterArr }}</div>
</template>

<style scoped></style>
